import { getStore } from "../../storage/storage"
import { axios } from "../../utils/axios"

// 获取用户留言列表
export function getUserMessageListApi(parameter){
    return axios({
        url: "/message/getUserMessageListApi",
        method: 'get',
        params: parameter,
        headers: {
            token: getStore("token")
        },
    })
}

// 审核
export function examineApi(parameter){
    return axios({
        url: "/message/examine",
        method: 'post',
        data: parameter,
        headers: {
            token: getStore("token")
        },
    })
}
export function deleteMessage(data){
    return axios({
        url: '/message/deleteMessage',
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 查询当前用户的所有消息
export const queryAllMessage = (params) =>{
    return axios({
        url: '/message/queryAllMessage',
        method: 'get',
        params: params,
        headers: {
            token: getStore("token")
        },
    })
}

// 得到每个用户或每个公司的消息列表
export const getMessageList = (params) =>{
    return axios({
        url: '/message/getMessageList',
        method: 'get',
        params: params,
        headers: {
            token: getStore("token")
        },
    })
}

//打开抽屉之后将未读消息变为已读
export const changeUnRead = (data) =>{
    return axios({
        url: '/message/changeUnRead',
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 根据messageAid和当前登陆人或公司账号查询对应的消息列表
export const getMessageByMessageAid = (params) =>{
    return axios({
        url: "/message/getMessageByMessageAid",
        method: 'get',
        params: params,
        headers: {
            token: getStore("token")
        },
    })
} 

// 发送消息
export const sendMessage = (data) =>{
    return axios({
        url: "/message/sendMessage",
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 插入一条消息（给公司打招呼）
export const insertMessage = (data) =>{
    return axios({
        url: "/message/insertMessage",
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 企业去跟用户沟通（给用户打招呼）
export const companyChatUser = (data) =>{
    return axios({
        url: "/message/companyChatUser",
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 发送简历（相当于也是发送一条消息）
export const sendResumeApi = (data) =>{
    return axios({
        url: "/message/sendResumeApi",
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 撤回消息
export const withdrawApi = (data) =>{
    return axios({
        url: "/message/withdrawApi",
        method: 'post',
        data: data,
        headers: {
            token: getStore("token")
        },
    })
}

// 判断企业是否与用户沟通过
export const checkIsChart = (parameter) =>{
    return axios({
        url: "/message/checkIsChart",
        method: 'get',
        params: parameter,
        headers: {
            token: getStore("token")
        },
    })
}


